package com.oig.sys.msg.im.handler;


import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * channel->Handler的映射关系
 *
 * @author xulele
 */
@Component
public class HandlerHolder {

    private final Map<String, BaseHandler> handlers = new HashMap<>(128);

    public void putHandler(String channelCode, BaseHandler handler) {
        handlers.put(channelCode, handler);
    }

    public BaseHandler route(String channelCode) {
        return handlers.get(channelCode);
    }

}
